package com.example.finalproject;

import androidx.appcompat.app.AppCompatActivity;

import android.app.ListActivity;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class history extends ListActivity {
    Handler handler = null;
    private static final String TAG="history";
    ArrayList<HistoryItem> historyItemList;
    MyAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_history);
//        ListView listView = getListView();
//        List<String> list1 = new ArrayList<String>();
//        for (int i = 1; i < 100; i++) {
//            list1.add(i + "item");
//        }
        DBManger dbManger = new DBManger(this);
        historyItemList= dbManger.listAll();
        Log.i(TAG,"historyItemList//="+historyItemList.get(0).getScore());
        adapter = new MyAdapter(history.this,R.layout.layout,historyItemList);
       // String[] list_data = {"one","two","three"};

       setListAdapter(adapter);
    }
        public void btn(View v){
        Intent back =new Intent(this,MainActivity.class);
        startActivityForResult(back,4); }

    }
